<%@ page language="java" contentType="text/html;charset=UTF-8" 	%>
<%@ page import="com.gouwudai.gobbs.pojo.TbbsMessage"%>
<%@ include file="../common/common.jsp" %>
<%@ include file="user_pass.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html> 
<head>
<title>短消息</title>
<%@ include file="../common/meta.inc" %>
<link href="css/frameBar.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-right: 0px;
	margin-left: 0px;
}
-->
</style>
</head>
<body>
<script language="javascript">
var isListBar=0;
var strColumns_Current;

function hideBar()
{
  strColumns_Current = "*,25"// top.tFrame.cols
  top.fFrame.rows = "*,128";
  document.all.barTop.src="images/barDown.gif";
  isListBar = 1;
}
  
function showBar()
{
  top.fFrame.rows = strColumns_Current;
  document.all.barTop.src="images/barTop.gif";
  isListBar = 0;
}
  
function isBar()
{
	if(isListBar==0)
	{
		hideBar();
	}else
	{
		showBar();
	}
}

function showMessage(obj)
{	
	openPop(obj,600,400,200,300);
	setTimeout("refreshMe()", 2000);
}

function refreshMe()
{
	location.assign(self.location);
}
</script>
<%
response.setHeader("Refresh", "360; URL=frameFoot.jsp");
//如果游客方式登陆
if(userLogin.getUserId()==null||userLogin.getUserId().intValue()==0)
{
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tab1">
<tr><td height="20" align="right"><span style="float:left">
在线(<strong><%=com.gouwudai.gobbs.listener.OnlineUserListener.getCurrentOnline()%></strong>)人&nbsp;
</span>
<img id="barTop" onclick="isBar()" style="cursor:hand" src="images/barTop.gif" border="0" alt="打开&&关闭工具栏" align="absmiddle" /> </td>
</tr>
<tr class="tab3">
<td height="80" valign="top" bgcolor="#FFFFFF"></td>
</tr>
</table>
<%
} else //已登陆
{	
	IMessageService messageService = (IMessageService)BeanManager.getBean("messageService");
	List list = messageService.listNew(LOGIN_ID);
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tab1">
<tr><td height="20" align="right"><span style="float:left">
<%
if(list.size()>0){
	TbbsMessage message = (TbbsMessage)list.get(0);
	out.print("<a onClick=\"showMessage(this);return false;\"  href=\"user_re_message_pop.jsp?messageReId="+message.getMessageId()+"\">"+
			"<font color=\"#ff0000\">您有新短信("+list.size()+")条</font></a>");
}else{
	out.print("在线<strong>(" + com.gouwudai.gobbs.listener.OnlineUserListener.getCurrentOnline()+")</strong>人&nbsp;");
}
%>
</span>
<img id="barTop" onclick="isBar()" style="cursor:hand" src="images/barTop.gif" border="0" alt="打开&&关闭工具栏" align="absmiddle" /> </td>
</tr>
<tr class="tab3"><td height="80" valign="top" bgcolor="#FFFFFF">
<%
if(list.size()>0){
	TbbsMessage message = (TbbsMessage)list.get(0);
	out.print("<a onClick=\"showMessage(this);return false;\" href=\"user_re_message_pop.jsp?messageReId="+message.getMessageId()+"\">"+
			message.getTitle()+
			"</a>");
	out.print("<div align=right><em>from:");
	out.print(message.getSendUser());
	out.print("</em></div>");	
	out.print(HtmlConst.formatDateHtml(message.getSendTime()));
}else{
	out.print("您没有新的短消息");
}%>
</td>
</tr>
</table>
<%}%>
</body>
</html>
